asp.net core 3.1 ajax partial view

59

asp.net core 3.1 ajax partial view -

public IActionResult GetPartial()
{
    List<string> countries = new List<string>();
    countries.Add("USA");
    countries.Add("UK");
    countries.Add("India");

    return PartialView("_CountriesPartial",countries);
}

asp.net core 3.1 ajax partial view -

<script>
    $(document).ready(function () {

        $("#button1").click(function () {
            $("#div1").load("/Home/GetPartial");
        });

    });
</script>

asp.net core 3.1 ajax partial view -

<button type="button" id="button1">Load Partial View</button>

<div id="div1"></div>

Comments

Submit
0 Comments